package cn.jinjimi.app.main.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cn.jinjimi.app.R;
import cn.jinjimi.app.custom.entity.CustomTagData;
import cn.jinjimi.app.main.adapter.extend.MyBaseAdapter;

/**
 * Created by libilang on 15/12/2.
 */
public class ExistTagAdapter extends MyBaseAdapter<CustomTagData> {

    private Context mContext;

    public ExistTagAdapter(Context context) {
        mContext = context;
        notifyDataSetChanged();
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder holder;
        if (convertView == null) {
            holder = new Holder();
            convertView = View.inflate(mContext, R.layout.item_exist_tag, null);
            holder.textView = (TextView) convertView.findViewById(R.id.tv_tag);
            convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }
        holder.textView.setText(getItem(position).getName());

        return convertView;
    }

    public class Holder {
        public TextView textView;
    }
}
